package com.yyhh.helpcall.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SpUtils {

    private static final String name = "sp_cache";
    private SharedPreferences sharedPreferences;
    public static SpUtils instance;

    public SpUtils(Context context){
        sharedPreferences = context.getSharedPreferences(name, Context.MODE_PRIVATE);
    }

    public static SpUtils getInstance(Context context){
        if(instance == null){
            instance = new SpUtils(context);
        }
        return instance;
    }

    public void putString(String key,String value){
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(key,value);
        editor.commit();
    }

    public String getString(String key){
        return sharedPreferences.getString(key,"");
    }
}
